<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="keywords" content="Gridea静态个人博客">
<meta name="description" content="这些都需要被记录">
<meta name="theme-color" content="#000">
<title>127.0.0.1、localhost、0.0.0.0 | zz</title>
<link rel="shortcut icon" href="/favicon.ico?v=1596469421894">
<link rel="stylesheet" href="/media/css/muse.css">
<link rel="stylesheet" href="/media/fonts/font-awesome.css">
<link
  href="//fonts.googleapis.com/css?family=Monda:300,300italic,400,400italic,700,700italic|Roboto Slab:300,300italic,400,400italic,700,700italic|Rosario:300,300italic,400,400italic,700,700italic|PT Mono:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext"
  rel="stylesheet" type="text/css">

<link href="/media/hljs/styles/androidstudio.css"
  rel="stylesheet">

<link rel="stylesheet" href="/styles/main.css">

<script src="/media/hljs/highlight.js"></script>
<script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.0/velocity.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.0/velocity.ui.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css"
  integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">


<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js"
  integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js"
  integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
  onload="renderMathInElement(document.body);"></script>





  <meta name="description" content="127.0.0.1、localhost、0.0.0.0" />
  <meta name="keywords" content="localhost" />
</head>

<body>
  <div class="head-top-line"></div>
  <div class="header-box">
    
<div class="muse">
  <header class="header bg-color ">
    <div class="blog-header box-shadow-wrapper  " id="header">
      <div class="nav-toggle" id="nav_toggle">
        <div class="toggle-box">
          <div class="line line-top"></div>
          <div class="line line-center"></div>
          <div class="line line-bottom"></div>
        </div>
      </div>
      <div class="site-meta">       
        <div class="site-title">
          
            <a href="/" class="brand">
              <span>zz</span>
            </a>  
          
        </div>
        
          <p class="subtitle">这些都需要被记录</p>
        
      </div>
      <nav class="site-nav" id="site_nav">
        <ul id="nav_ul">
          
            
            
            <li class="nav-item ">
              
              
                <a href="/" target="_self">
                  <i class="fa fa-home"></i> 文章
                </a>
              
            </li>
          
            
            
            <li class="nav-item ">
              
              
                <a href="/tags/" target="_self">
                  <i class="fa fa-tags"></i> 标签
                </a>
              
            </li>
          
          
          
            <li id="fa_search" class="nav-item">
              <a href="javascript:void(0);">
                <i class="fa fa-search"></i> <span class="language" data-lan="search">搜索</span>
              </a>
            </li>
          
        </ul>
      </nav>
    </div>
  </header>
</div>

<script type="text/javascript"> 
 
  let showNav = true;

  let navToggle = document.querySelector('#nav_toggle'),
  siteNav = document.querySelector('#site_nav');
  
  function navClick() {
    let sideBar = document.querySelector('.sidebar');
    let navUl = document.querySelector('#nav_ul');
    navToggle.classList.toggle('nav-toggle-active');
    siteNav.classList.toggle('nav-menu-active');
    if (siteNav.classList.contains('nav-menu-active')) {
      siteNav.style = "height: " + (navUl.children.length * 42) +"px !important";
    } else {
      siteNav.style = "";
    }
  }

  navToggle.addEventListener('click',navClick);  
</script>
  </div>
  <div class="main-continer">
    
    <div
      class="section-layout muse bg-color">
      <div class="section-layout-wrapper">
        

<div class="sidebar">
  
    <div class="sidebar-box box-shadow-wrapper  right-motion" id="sidebar">
      
        <div class="post-list-sidebar">
          <div class="sidebar-title">
            <span id="tocSideBar" class="sidebar-title-item sidebar-title-active language" data-lan="index">文章目录</span>
            <span id="metaSideBar" class="sidebar-title-item language" data-lan="preview">站点概览</span>
          </div>
        </div>
      
      <div class="sidebar-body muse" id="sidebar_body">
        
          
            <div class="post-side-meta" id="post_side_meta">
              
<div class="sidebar-wrapper box-shadow-wrapper ">
  <div class="sidebar-item">
    <img class="site-author-image right-motion" src="/images/avatar.png"/>
    <p class="site-author-name">zz</p>
    
    <div class="site-description right-motion">
      
      
      
        <p>帅</p>
      
      
    </div>
    
  </div>
  <div class="sidebar-item side-item-stat right-motion">
    <div class="sidebar-item-box">
      <a href="/archives/">
        
        <span class="site-item-stat-count">9</span>
        <span class="site-item-stat-name language" data-lan="article">文章</span>
      </a>
    </div>
    <div class="sidebar-item-box">
      <a href="">
        <span class="site-item-stat-count">11</span>
        <span class="site-item-stat-name language" data-lan="category">分类</span>
      </a>
    </div>
    <div class="sidebar-item-box">
      <a href="/tags/">
        <span class="site-item-stat-count">11</span>
        <span class="site-item-stat-name language" data-lan="tag">标签</span>
      </a>
    </div>
  </div>
  
  
    <div class="sidebar-item sidebar-item-social">
      <div class="social-item">
        
          
            <a href="https://github.com/broholens">
              <i class="fa fa-github-alt" title="GITHUB"></i>
            </a>
          
        
        
      </div>
    </div>
  

  



</div>
            </div>
            <div class="post-toc sidebar-body-active" id="post_toc" style="opacity: 1;">
              <div class="toc-box right-motion">
  <div class="toc-wrapper auto-number auto"
    id="toc_wrapper">
    <ul class="markdownIt-TOC">
<li>
<ul>
<li><a href="#127001">127.0.0.1</a><br>
*
<ul>
<li><a href="#%E7%94%A8%E9%80%94">用途</a></li>
</ul>
</li>
<li><a href="#0000">0.0.0.0</a><br>
*
<ul>
<li><a href="#%E7%94%A8%E9%80%94-2">用途</a></li>
</ul>
</li>
<li><a href="#localhost">localhost</a></li>
</ul>
</li>
</ul>

  </div>
</div>

<script>

  let lastTop = 0, lList = [], hList = [], postBody, lastIndex = -1;
  let active = 'active-show', activeClass = 'active-current';
  let tocWrapper = document.querySelector('#toc_wrapper');
  let tocContent = tocWrapper.children[0];
  let autoNumber = tocWrapper && tocWrapper.classList.contains('auto-number');

  function addTocNumber(elem, deep) {
    if (!elem) {
      return;
    }
    let prop = elem.__proto__;

    if (prop === HTMLUListElement.prototype) {
      for (let i = 0; i < elem.children.length; i++) {
        addTocNumber(elem.children[i], deep + (i + 1) + '.');
      }
    } else if (prop === HTMLLIElement.prototype) {
      // 保存li元素
      if (elem.children[0] && elem.children[0].__proto__ === HTMLAnchorElement.prototype) {
        lList.push(elem);
      }
      for (let i = 0; i < elem.children.length; i++) {
        let cur = elem.children[i];
        if (cur.__proto__ === HTMLAnchorElement.prototype) {
          if (autoNumber) {
            cur.text = deep + ' ' + cur.text;
          }
        } else if (cur.__proto__ === HTMLUListElement.prototype) {
          addTocNumber(cur, deep);
        }
      }
    }
  }

  function removeParentActiveClass() {
    let parents = tocContent.querySelectorAll('.' + active)
    parents.forEach(function (elem) {
      elem.classList.remove(active);
    });
  }

  function addActiveClass(index) {
    if (index >= 0 && index < hList.length) {
      lList[index].classList.add(activeClass);
    }
  }

  function removeActiveClass(index) {
    if (index >= 0 && index < hList.length) {
      lList[index].classList.remove(activeClass);
    }
  }

  function addActiveLiElemment(elem, parent) {
    if (!elem || elem === parent) {
      return;
    } else {
      if (elem.__proto__ === HTMLLIElement.prototype) {
        elem.classList.add(active);
      }
      addActiveLiElemment(elem.parentElement, parent);
    }
  }

  function showToc() {
    if (tocWrapper) {
      postBody = document.querySelector('#post_body');
      for (let i = 0; i < postBody.children.length; i++) {
        if (postBody.children[i].__proto__ === HTMLHeadingElement.prototype) {
          hList.push(postBody.children[i]);
        }
      }
      if (tocWrapper.classList.contains('compress')) {
        tocContent.classList.add('closed');
      } else if (tocWrapper.classList.contains('no_compress')) {
        tocContent.classList.add('expanded');
      } else {
        if (hList.length > 10) {
          active = 'active-hidden'
          tocContent.classList.add('closed');
        } else {
          tocContent.classList.add('expanded');
        }
      }
    }
  }

  (function () {
    // 处理不是从#一级标题开始目录
    if (tocContent.children.length === 1 && tocContent.children[0].__proto__ === HTMLLIElement.prototype) {
      let con = tocContent.children[0].children[0];
      tocContent.innerHTML = con.innerHTML;
    }
    let markdownItTOC = document.querySelector('.markdownIt-TOC');
    let innerHeight = window.innerHeight;
    markdownItTOC.style = `max-height: ${innerHeight - 80 > 0 ? innerHeight - 80 : innerHeight}px`
    addTocNumber(tocContent, '');
  })();

  document.addEventListener('scroll', function (e) {
    if (lList.length <= 0) {
      return;
    }
    let scrollTop = document.scrollingElement.scrollTop + 10;
    let dir;

    if (lastTop - scrollTop > 0) {
      dir = 'up';
    } else {
      dir = 'down';
    }

    lastTop = scrollTop;
    if (scrollTop <= 0) {
      if (lastIndex >= 0 && lastIndex < hList.length) {
        lList[lastIndex].classList.remove(activeClass);
      }
      return;
    }

    let current = 0, hasFind = false;
    for (let i = 0; i < hList.length; i++) {
      if (hList[i].offsetTop > scrollTop) {
        current = i;
        hasFind = true;
        break;
      }
    }
    if (!hasFind && scrollTop > lList[lList.length - 1].offsetTop) {
      current = hList.length - 1;
    } else {
      current--;
    }
    if (dir === 'down') {
      if (current > lastIndex) {
        addActiveClass(current);
        removeActiveClass(lastIndex)
        lastIndex = current;
        removeParentActiveClass();
        lList[current] && addActiveLiElemment(lList[current].parentElement, tocContent);
      }
    } else {
      if (current < lastIndex) {
        addActiveClass(current);
        removeActiveClass(lastIndex);
        lastIndex = current;
        removeParentActiveClass();
        lList[current] && addActiveLiElemment(lList[current].parentElement, tocContent);
      }
    }
  });


  window.addEventListener('load', function () {
    showToc();
    document.querySelector('#sidebar').style = 'display: block;';
    tocWrapper.classList.add('toc-active');
    setTimeout(function () {
      if ("createEvent" in document) {
        let evt = document.createEvent("HTMLEvents");
        evt.initEvent("scroll", false, true);
        document.dispatchEvent(evt);
      }
      else {
        document.fireEvent("scroll");
      }
    }, 500)
  })

</script>
            </div>
          
        
      </div>
    </div>
  
</div>
<script>
  const SIDEBAR_TITLE_ACTIVE = 'sidebar-title-active';
  const SIDEBAR_BODY_ACTIVE = 'sidebar-body-active';
  const SLIDE_UP_IN = 'slide-up-in';

  let sidebar = document.querySelector('#sidebar'),
  tocSideBar = document.querySelector('#tocSideBar'),
  metaSideBar = document.querySelector('#metaSideBar'),
  postToc = document.querySelector('#post_toc'),
  postSiteMeta = document.querySelector('#post_side_meta'),
  sidebarTitle = document.querySelector('.sidebar-title'),
  sidebarBody = document.querySelector('#sidebar_body');

  tocSideBar && tocSideBar.addEventListener('click', (e) => {
    toggleSidebar(e);
  });

  metaSideBar && metaSideBar.addEventListener('click', (e) => {
    toggleSidebar(e);
  });

  function toggleSidebar(e) {
    let currentTitle = document.querySelector("."+SIDEBAR_TITLE_ACTIVE);
    if (currentTitle == e.srcElement) {
      return ;
    }
    let current, showElement, hideElement;
    if (e.srcElement == metaSideBar) {
      showElement = postSiteMeta;
      hideElement = postToc;
    } else if (e.srcElement == tocSideBar){
      showElement = postToc;
      hideElement = postSiteMeta;
    }
    currentTitle.classList.remove(SIDEBAR_TITLE_ACTIVE);
    e.srcElement.classList.add(SIDEBAR_TITLE_ACTIVE);

    window.Velocity(hideElement, 'stop');
    window.Velocity(hideElement, 'transition.slideUpOut', {
      display: 'none',
      duration: 200,
      complete: function () {
        window.Velocity(showElement, 'transition.slideDownIn', {
          duration: 200
        });
      }
    })
    hideElement.classList.remove(SIDEBAR_BODY_ACTIVE);
    showElement.classList.add(SIDEBAR_BODY_ACTIVE);
  }

  postToc && postToc.addEventListener('transitionend', function() {
    this.classList.remove(SLIDE_UP_IN);
  });

  if (sidebarBody) {
    if (sidebarBody.classList.contains('pisces') || sidebarBody.classList.contains('gemini')) {
      let hasFix = false;
      let scrollEl = document.querySelector('.main-continer');
      let limitTop = document.querySelector('#nav_ul').children.length * 42 + 162;
      window.addEventListener('scroll', function(e) {
        if (document.scrollingElement.scrollTop >= limitTop) {
          if (!hasFix) {
            sidebar.classList.add('sidebar-fixed');
            hasFix = true;
          }
        } else {
          if (hasFix) {
            sidebar.classList.remove('sidebar-fixed');
            hasFix = false;
          }
        }
      });
    }
  }
  
</script>
        <div class="section-box box-shadow-wrapper">
          <div class="section bg-color post post-page">
            <header class="post-header">
  <h1 class="post-title">
    <a class="post-title-link" href="https://broholens.github.io/post/6387ia0vK/">
      127.0.0.1、localhost、0.0.0.0
    </a>
  </h1>
  <div class="post-meta">
    
    <span class="meta-item pc-show">
      <i class="fa fa-calendar-o"></i>
      <span class="language" data-lan="publish">发布于</span>
      <span>2020-06-11</span>
      <span class="post-meta-divider pc-show">|</span>
    </span>
    
    <span class="meta-item">
      <i class="fa fa-folder-o"></i>
      <span class="pc-show language" data-lan="category-in">分类于</span>
      
      
      <a href="https://broholens.github.io/tag/0o5IblU3T/">
        <span>localhost</span>
      </a>
      
      
    </span>
    <span class="post-meta-divider">|</span>
    
    <span class="meta-item">
      <i class="fa fa-clock-o"></i>
      <span>1<span class="language" data-lan="minute">分钟</span></span>
    </span>
    <span class="meta-item">
      <span class="post-meta-divider">|</span>
      <i class="fa fa-file-word-o"></i>
      <span>212<span class="pc-show language" data-lan="words">字数</span></span>
    </span>
    
    
    
    <span id="/post/6387ia0vK/" data-flag-title="127.0.0.1、localhost、0.0.0.0" class="meta-item pc-show leancloud_visitors">
      <span class="post-meta-divider">|</span>
      <i class="fa fa-eye"></i>
      <span><span class="language" data-lan="view">浏览量</span>：<span class="leancloud-visitors-count"></span></span>
    </span>
    
  </div>
</header>
            <div class="post-body next-md-body" id="post_body">
              <h2 id="127001">127.0.0.1</h2>
<p>属于环回地址，环回地址：所有发往该类地址的数据包都应该被loop back。<br><br>
使用这个地址发送数据，则数据包不会出现在网络传输过程中。</p>
<h4 id="用途">用途</h4>
<ul>
<li>测试某台机器上的网络设备，操作系统或者TCP/IP实现是否工作正常：ping 127.0.0.1</li>
</ul>
<h2 id="0000">0.0.0.0</h2>
<ul>
<li>在服务器中，0.0.0.0指的是本机上的所有IPV4地址</li>
<li>在路由中，0.0.0.0表示的是默认路由，即当路由表中没有找到完全匹配的路由的时候所对应的路由。</li>
</ul>
<h4 id="用途-2">用途</h4>
<ul>
<li>如果主机有大小网两个IP，且主机上一个服务监听的地址为0.0.0.0，则两个IP均可访问该服务。</li>
</ul>
<h2 id="localhost">localhost</h2>
<p>域名。默认指向127.0.0.1</p>

            </div>
            
              <div class="reward-btn">
                <div class="reward-btn-text">赞赏</div>
              </div>
            
            
              <div class="post-footer">
  <ul class="post-copyright">
    <li class="post-copyright-author">
      <strong class="language" data-lan="author">本文作者：</strong>
      zz
    </li>
    <li class="post-copyright-link">
      <strong class="language" data-lan="link">本文链接：</strong>
      <a href="https://broholens.github.io/post/6387ia0vK/" title="127.0.0.1、localhost、0.0.0.0">https://broholens.github.io/post/6387ia0vK/</a>
    </li>
    <li class="post-copyright-license">
      <strong class="language" data-lan="copyright">版权声明： </strong>
      本博客所有文章除特别声明外，均采用<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i> BY-NC-SA</a> 许可协议。转载请注明出处！
    </li>
  </ul>
  <div class="tags">
    
      <a href="https://broholens.github.io/tag/0o5IblU3T/"># localhost</a>
    
  </div>
  <div class="nav">
    <div class="nav-prev">
      
        <i class="fa fa-chevron-left"></i>
        <a class="nav-pc-next" title="python pathlib" href="https://broholens.github.io/post/RhlpoFTTh/">python pathlib</a class="nav-pc-next">
        <a class="nav-mobile-prev" title="python pathlib" href="https://broholens.github.io/post/RhlpoFTTh/">上一篇</a>
      
    </div>
    <div class="nav-next">
      
        <a class="nav-pc-next" title="git commit --amend修改commit信息后，push报错" href="https://broholens.github.io/post/git-commit-amend-xiu-gai-commit-xin-xi-hou-push-bao-cuo/">git commit --amend修改commit信息后，push报错</a>
        <a class="nav-mobile-next" title="git commit --amend修改commit信息后，push报错" href="https://broholens.github.io/post/git-commit-amend-xiu-gai-commit-xin-xi-hou-push-bao-cuo/">下一篇</a>
        <i class="fa fa-chevron-right"></i>
      
    </div>
  </div>
</div>
            
            
  
    
      <link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>

<div id="gitalk-container"></div>

<script>
  var gitalk = new Gitalk({
    clientID: '2a0626e1d23ca047a994',
    clientSecret: '7b304e4229929cea024fb833328fd7cbb3651a7a',
    repo: 'https://github.com/broholens/GitalkRepo',
    owner: 'broholens',
    admin: ['broholens'],
    id: (location.pathname).substring(0, 49),      // Ensure uniqueness and length less than 50
    distractionFreeMode: false  // Facebook-like distraction free mode
  })
  gitalk.render('gitalk-container')
</script>
    
    
  

          </div>
        </div>
      </div>
    </div>
    <div class="footer-box">
  <footer class="footer">
    <div class="copyright">
      Powered by <a href="https://github.com/getgridea/gridea" target="_blank">Gridea</a> | © 2019-2020 Theme By <a
        href="https://github.com/hsxyhao/gridea-theme-next" target="_blank">HsxyHao</a>
    </div>
    <div class="poweredby">
      FBI WARNING: 转载请注明出处
    </div>
  </footer>
  
  
  <div class="drawer-box left" id="drawer_box">
    <span class="muse-line muse-line-first"></span>
    <span class="muse-line muse-line-middle"></span>
    <span class="muse-line muse-line-last"></span>
  </div>
  
  <div class="muse back-to-top" id="back_to_top">
    <i class="fa fa-arrow-up"></i>
    
  </div>
  
  
  
</div>
<script>

  let sideBarOpen = 'sidebar-open';
  let body = document.body;
  let back2Top = document.querySelector('#back_to_top'),
    back2TopText = document.querySelector('#back_to_top_text'),
    drawerBox = document.querySelector('#drawer_box'),
    rightSideBar = document.querySelector('.sidebar'),
    viewport = document.querySelector('body');

  function scrollAnimation(currentY, targetY) {

    let needScrollTop = targetY - currentY
    let _currentY = currentY
    setTimeout(() => {
      const dist = Math.ceil(needScrollTop / 10)
      _currentY += dist
      window.scrollTo(_currentY, currentY)
      if (needScrollTop > 10 || needScrollTop < -10) {
        scrollAnimation(_currentY, targetY)
      } else {
        window.scrollTo(_currentY, targetY)
      }
    }, 1)
  }

  back2Top.addEventListener("click", function (e) {
    scrollAnimation(document.scrollingElement.scrollTop, 0);
    e.stopPropagation();
    return false;
  });

  window.addEventListener('scroll', function (e) {
    let percent = document.scrollingElement.scrollTop / (document.scrollingElement.scrollHeight - document.scrollingElement.clientHeight) * 100;
    if (percent > 1 && !back2Top.classList.contains('back-top-active')) {
      back2Top.classList.add('back-top-active');
    }
    if (percent == 0) {
      back2Top.classList.remove('back-top-active');
    }
    if (back2TopText) {
      back2TopText.textContent = Math.floor(percent);
    }
  });


  let hasCacu = false;
  window.onresize = function () {
    calcuHeight();
  }

  function calcuHeight() {
    // 动态调整站点概览高度
    if (!hasCacu && back2Top.classList.contains('pisces') || back2Top.classList.contains('gemini')) {
      let sideBar = document.querySelector('.sidebar');
      let navUl = document.querySelector('#site_nav');
      sideBar.style = 'margin-top:' + (navUl.offsetHeight + navUl.offsetTop + 15) + 'px;';
      hasCacu = true;
    }
  }
  calcuHeight();

  let open = false, MOTION_TIME = 300, RIGHT_MOVE_DIS = '320px';

  if (drawerBox) {
    let rightMotions = document.querySelectorAll('.right-motion');
    let right = drawerBox.classList.contains('right');

    let transitionDir = right ? "transition.slideRightIn" : "transition.slideLeftIn";

    let openProp, closeProp;
    if (right) {
      openProp = {
        paddingRight: RIGHT_MOVE_DIS
      };
      closeProp = {
        paddingRight: '0px'
      };
    } else {
      openProp = {
        paddingLeft: RIGHT_MOVE_DIS
      };
      closeProp = {
        paddingLeft: '0px'
      };
    }

    drawerBox.onclick = function () {
      open = !open;
      window.Velocity(rightSideBar, 'stop');
      window.Velocity(viewport, 'stop');
      window.Velocity(rightMotions, 'stop');
      if (open) {
        window.Velocity(rightSideBar, {
          width: RIGHT_MOVE_DIS
        }, {
          duration: MOTION_TIME,
          begin: function () {
            window.Velocity(rightMotions, transitionDir, {});
          }
        })
        window.Velocity(viewport, openProp, {
          duration: MOTION_TIME
        });
      } else {
        window.Velocity(rightSideBar, {
          width: '0px'
        }, {
          duration: MOTION_TIME,
          begin: function () {
            window.Velocity(rightMotions, {
              opacity: 0
            });
          }
        })
        window.Velocity(viewport, closeProp, {
          duration: MOTION_TIME
        });
      }
      for (let i = 0; i < drawerBox.children.length; i++) {
        drawerBox.children[i].classList.toggle('muse-line');
      }
      drawerBox.classList.toggle(sideBarOpen);
    }
  }

  // 链接跳转
  let newWindow = 'false'
  if (newWindow === 'true') {
    let links = document.querySelectorAll('.post-body a')
    links.forEach(item => {
      if (!item.classList.contains('btn')) {
        item.setAttribute("target", "_blank");
      }
    })
  }

  let faSearch = document.querySelector('#fa_search');
  faSearch.addEventListener('click', function () {
    document.querySelector('#search_mask').style = ''
  })

  // 代码高亮
  hljs.initHighlightingOnLoad();
  
  // 离开当前页title变化
  var leaveTitle = '';
  if (leaveTitle) {
    document.addEventListener('visibilitychange', function () {
      if (document.visibilityState == 'hidden') {
        normal_title = document.title;
        document.title = leaveTitle;
      } else {
        document.title = normal_title;
      }
    });
  }

</script>
    <div class="light-box" id="light_box"></div>
<script>
  let imgs = document.querySelectorAll('.post-body img');
  let lightBox = document.querySelector('#light_box');
  lightBox.addEventListener('mousedown', (e) => {
    e.preventDefault()
  })
  lightBox.addEventListener('mousewheel', (e) => {
    e.preventDefault()
  })
  let width = window.innerWidth * 0.8;
  lightBox.onclick = () => {
    let img = lightBox.querySelector('img');
    lightBox.style = '';
    img && img.remove();
  }
  imgs.forEach(item => {
    item.onclick = function (e) {
      let lightImg = document.createElement('img');
      lightImg.src = this.src;
      lightBox.style = `height: 100%; opacity: 1; background-color: rgba(0, 0, 0, 0.5);cursor: zoom-out;`;
      lightImg.style = `width: ${width}px; border: 1px solid #fff; border-radius: 2px;`;
      lightImg.onclick = function () {
        lightBox.style = '';
        this.remove();
      }
      lightBox.append(lightImg);
    }
  })
</script>
    <div class="reward-mask" style="display: none;">
  <div class="reward-relative">
    <span class="close" aria-hidden="true">x</span>
    <div class="reward-body">
      <h2>感谢您的支持，我会继续努力的!</h2>
      <div class="reward-img-box">
        <div style="position: relative; width: 140px; height: 140px;">
          
          
            <img id="zfb" class="reward-img" src="\media\images\custom-zfbImg.jpg" alt="赞赏码">
          
          
            <img id="wx" class="reward-img" src="\media\images\custom-wxImg.jpg" alt="赞赏码">
          
        </div>
      </div>
      <p class="reward-word">喜欢的话请我喝咖啡呀</p>
      <p class="reward-tip"></p>
    </div>
    <div class="bottom">
      
      <div id="zfbBtn" class="pay-text">
        支付宝
      </div>
      
      
      <div id="wxBtn" class="pay-text">
        微信支付
      </div>
      
    </div>
  </div>
</div>
<style>
  .reward-mask {
    position: fixed;
    z-index: 99999;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #00000054;
  }

  .reward-relative {
    position: relative;
    width: 480px;
    text-align: center;
    margin: 0 auto;
    border-radius: 5px;
    background-color: #fff;
    top: 50%;
    margin-top: -205px;
  }

  .reward-relative .close {
    position: absolute;
    right: 10px;
    font-weight: normal;
    font-size: 16px;
    color: #929292;
  }

  .reward-body {
    padding: 40px 20px 20px;
  }

  .bottom {
    display: flex;
  }

  .reward-btn {
    text-align: center;
  }

  .reward-btn-text {
    display: inline-block;
    cursor: pointer;
    width: 60px;
    height: 60px;
    line-height: 60px;
    border-radius: 50%;
    background-color: #ff9734;
    color: #FFF;
    margin-top: 20px;
  }

  .pay-text {
    margin-top: 10px;
    padding: 10px;
    flex: 1;
    transition: all .2s linear;
  }

  .pay-text:hover {
    background-color: #a5a5a536;
  }

  .reward-body h2 {
    padding-top: 10px;
    text-align: center;
    color: #a3a3a3;
    font-size: 16px;
    font-weight: normal;
    margin: 0 0 20px;
  }

  .reward-body h2:after,
  .reward-body h2:before {
    font-family: Arial, Helvetica, sans-serif;
    background: 0 0;
    width: 0;
    height: 0;
    font-style: normal;
    color: #eee;
    font-size: 80px;
    position: absolute;
    top: 20px;
  }

  .reward-body h2:before {
    content: '\201c';
    left: 50px;
  }

  .reward-body h2:after {
    content: '\201d';
    right: 80px;
  }

  .reward-img-box {
    display: inline-block;
    padding: 10px;
    border: 6px solid #ea5f00;
    margin: 0 auto;
    border-radius: 3px;
    position: relative;
  }

  .reward-img {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
  }

  @media (max-width: 767px) {
    .reward-relative {
      height: 100%;
      top: 0px;
      margin-top: 0;
      width: auto;
    }

    .reward-relative .bottom {
      flex-direction: column;
    }

    .reward-relative .pay-text {
      width: 80%;
      margin: 5px auto;
      border: 1px solid silver;
      padding: 6px;
      border-radius: 4px;
    }

    .reward-body h2:after {
      right: 40px;
    }

    .reward-body h2:after,
    .reward-body h2:before {
      font-size: 60px;
    }

    .reward-body h2:before {
      left: 20px;
    }
  }
</style>
<script>
  !function () {
    var mask = document.querySelector('.reward-mask');
    let close = document.querySelector('.reward-relative .close');
    let rewardBtn = document.querySelector('.reward-btn');

    let zfb = document.querySelector('#zfb'),
      wx = document.querySelector('#wx'),
      zfbBtn = document.querySelector('#zfbBtn'),
      wxBtn = document.querySelector('#wxBtn');

    if (zfbBtn && wxBtn) {
      zfbBtn.addEventListener('click', () => {
        window.Velocity(zfb, 'transition.slideLeftIn', {
          duration: 400
        });
        window.Velocity(wx, 'transition.slideRightOut', {
          display: 'none',
          duration: 400
        });
      });

      wxBtn.addEventListener('click', () => {
        window.Velocity(wx, 'transition.slideRightIn', {
          duration: 400
        });
        window.Velocity(zfb, 'transition.slideLeftOut', {
          display: 'none',
          duration: 400
        });
      });
    }

    rewardBtn.addEventListener('click', (e) => {
      window.Velocity(mask, 'transition.slideDownIn', {
        duration: 400
      })
    });

    close.addEventListener('click', (e) => {
      e.preventDefault();
      window.Velocity(mask, 'transition.slideUpOut', {
        duration: 400
      })
    })
  }()
</script>

  </div>
</body>

  <div class="search-mask" id="search_mask" style="display: none;">
  <div class="search-box">
    <div class="search-title">
      <i class="fa fa-search"></i>
      <div class="input-box">
        <input id="search" type="text" class="language" data-lan="search" placeholder="搜索">
      </div>
      <i id="close" class="fa fa-times-circle"></i>
    </div>
    <div class="stat-box">
      <span id="stat_count">0</span><span class="language" data-lan="stat">条相关条目，使用了</span><span id="stat_times">0</span><span class="language" data-lan="stat-time">毫秒</span>
      <hr>
    </div>
    <div class="result" id="result">
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/yXzaO5vHg/"" data-c="
          &lt;p&gt;今天下班的时候，被一位中年大叔叫住。大叔描述自己从外地来西安出差，手机落在出租车上了，已经关机。已经报警，警察给的措施是送到救济站，自己拒绝了。然后借我手机给秘书打了电话，通话1分25秒，内容大致如下：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;描述自己手机丢失。&lt;/li&gt;
&lt;li&gt;明天还有重要会议。&lt;/li&gt;
&lt;li&gt;让秘书订一张机票过来。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;通话期间递给我中华烟（以不抽烟为由拒绝），通话完后，询问我在哪儿住（表明合租，暗示不方便）、能不能借他去机场的路费（以身上没带现金为由拒绝），在得到拒绝后询问我能否在便利店换取现金。上面的请求均遭到了我的拒绝后他表示再问问其他人。&lt;/p&gt;
&lt;p&gt;走了一段时间后，内心也挺挣扎的——如果换做是我在陌生的地方丢手机呢——这是我性格的软肋。现在想来，这起事件有太多疑点，谎言几乎流于表面了，但身处其中时却并未考虑到这些。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;请秘书联系出差对接的人过来接一下自己不行吗？&lt;/li&gt;
&lt;li&gt;去机场完全可以请我帮忙叫滴滴，为何非要现金？&lt;/li&gt;
&lt;li&gt;为何在报警的时候不借警察手机通知秘书？&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;纵观整个事件，我的损失有：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;泄露了手机号&lt;/li&gt;
&lt;li&gt;事件过程耽误了10分钟左右时间&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;目前为止，我已经判定这次对话他是不怀好意的。于是很愤懑：这些人为了蝇头小利一次次消磨人与人之间的信任，实在可恶。但是下次面对陌生人的求助时，是该耐心听完并慷慨解囊呢，还是不给TA诉说的机会？恐怕我们能做的和警察一样多！&lt;/p&gt;
">信任的边界</a>
      </div>
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/gsJOcOPhl/"" data-c="
          &lt;p&gt;作者：尤瓦尔·赫拉利&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第一章   人类：一种也没什么特别的动物&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;物种和属&lt;/abbr&gt;&lt;br&gt;
同一物种：彼此交配，且能够产出下一代。马和驴&lt;br&gt;
同一属：同一祖先演化而来的不同物种。狮子和老虎&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;大脑&lt;/abbr&gt;&lt;br&gt;
人类大脑明显大于其他动物；大脑结构脆弱，消耗能量惊人。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;直立行走&lt;/abbr&gt;&lt;br&gt;
于是人类的手开始能够处理非常精细的任务，特别是能够生产、使用复杂的工具。&lt;br&gt;
使妇女产道宽度受限...自然选择使生产提前，与其他动物相比，人类都是早产儿，许多重要器官发育不够完善。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;社交的来源&lt;/abbr&gt;&lt;br&gt;
独自一人的母亲拖着孩子难以获取足够的食物。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;人类崛起&lt;/abbr&gt;&lt;br&gt;
直到十万年前智人崛起，人类才一跃居于食物链顶端。&lt;br&gt;
人类转眼就登上顶端，不仅让生态系统猝不及防，就连人类自己也不知所措。&lt;br&gt;
人类历史的众多灾难，无论是生灵涂炭的战争还是生态遭遇的浩劫，其实都源自这场过于仓促的地位跳跃。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;使用火&lt;/abbr&gt;&lt;br&gt;
杀死寄生虫和病菌、所需要咀嚼和消化的时间也能大幅减少。&lt;br&gt;
烹饪技术的发展与人体肠道缩短、大脑开始发育有直接关系。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;其他人种的灭绝&lt;/abbr&gt;&lt;br&gt;
&amp;quot;替代理论&amp;quot;比&amp;quot;混种繁衍理论&amp;quot;更加政治正确。&lt;br&gt;
现实的生物界限并不是非黑即白，而是由重要的灰色地带组成。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第二章   知善恶树&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;认知革命&lt;/abbr&gt;&lt;br&gt;
大约在7万到3万年前，智人发明了船、油灯、弓箭。出现了新的思维和沟通方式方式，这也正是所谓的认知革命。&lt;br&gt;
认知革命前我们从生物学角度研究智人，认知革命后我们从历史学角度研究智人。&lt;br&gt;
认知革命后，智人开启了一条采用&amp;quot;文化演进&amp;quot;的快速道路，而不再停留在&amp;quot;基因演化&amp;quot;。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;人类语言的特别之处&lt;/abbr&gt;&lt;br&gt;
语言灵活、信息量大。&lt;br&gt;
社会信息的交流(八卦理论)&lt;br&gt;
讨论虚构事物&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;虚构&lt;/abbr&gt;&lt;br&gt;
虚构这件事的重点不是人类能够拥有想象，而是可以一起想象。&lt;br&gt;
宗教故事、国家故事、法律故事。&lt;br&gt;
除了存在于人类共同的想象之外，这个宇宙中根本没有神、没有国家、没有钱、没有法律、没有正义。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;150人理论&lt;/abbr&gt;&lt;br&gt;
借由八卦来维持的最大&amp;quot;自然&amp;quot;团体大约是150人。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;标致公司&lt;/abbr&gt;&lt;br&gt;
该以什么标准，我们才能说标致公司确实存在？&lt;br&gt;
标致公司只是我们集体想象的一个法律故事。有人讲这个故事，而我们信了，从此就有了标志公司。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;双重现实&lt;/abbr&gt;&lt;br&gt;
从认知革命以来，智人就一直生活在一种双重现实之中。一方面，我们有河流树木这些确实存在的客观现实；另一方面，我们也有神和国家这样的想象现实。随着时间过去，想象的现实也日益强大；时至今日，河流树木想要生存，有时候还得仰赖神和国家这些想象现实行行好、放他们一马。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第二十章   智人末日&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;生物工程&lt;/abbr&gt;&lt;br&gt;
未阉割的公牛称为bull，阉割后的称为ox。&lt;br&gt;
现在人类太快看到太多的机会，手中已握有基因修改能力，却还无法做出明智、有远见的决定。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;现代晚期世界&lt;/abbr&gt;&lt;br&gt;
已有尼安德特人的DNA，考虑是否再现他们。&lt;br&gt;
既然已知某段DNA的功能，何不嫁接设计超人类？&lt;br&gt;
从最开始离不开假肢，到现在离不开手机，确切来说，现代人更应该被称为生化人。&lt;/p&gt;
&lt;p&gt;&lt;abbr title=&#34;&#34;&gt;脑机双向接口&lt;/abbr&gt;&lt;br&gt;
计算机读取人脑电子信号，处理后输出人脑能够理解的电子信号。这样一来，人类想知道什么便能知道什么(可以随时google)；也可以将想法直接输出给其他人，不再需要繁杂又难以理解的语言。恐怕那个时候的人再看如今的你我，正如你看尼安德特人一般。&lt;/p&gt;
">人类简史</a>
      </div>
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/2_HUa5MT3/"" data-c="
          &lt;p&gt;我困在一个牢笼里，这个牢笼像甜甜圈做成的，兜兜转转，是原点。&lt;/p&gt;
&lt;p&gt;实不相瞒，我曾尝试过千万次挣脱这个牢笼，结果只是徒劳。5月23日，我拖了地，把马桶盖和洗手池擦得锃亮；床单扔进洗衣机，短袖和袜子手洗了。拉开窗帘打开窗，看着远处的秦岭——黑色的山，上面点缀着几片云——有一种声音在胸腔呼之欲出：我会跟从前不一样的！&lt;/p&gt;
&lt;p&gt;结果？结果就是这个周末，做完上面的事情后，我盯着冠捷显示屏，用varmilo键盘敲下这些字。我又走了一圈。我又将重新开始。&lt;/p&gt;
&lt;p&gt;在之前的很长时间里，我都无法跳出去，所以便开始为这个牢笼正名。正名是这个世界上最扯淡的事情，你只需要自说自话，或者说自欺欺人。什么自由啦、生活啦、现在的年轻人啦、大不了啦、无所谓啦，只要你想往里加，都可以加进去。从此便过上了一种舒适且心安的日子：早上慌忙起床上班，上着扯来扯去的班，写着毫无意义的代码，用生命打一局又一局的游戏，躺在床上和手机里。&lt;/p&gt;
&lt;p&gt;但又开始察觉到不对劲了，因为某天有人在我耳旁说了一句：不能再这么吊儿郎当了。尽管知道这话不是说给我听的，但既然听到了，就从脑子里过了一遍。发现自己不仅上有二老、有婚要结，还有房贷要还。我想，如果他还要继续说的话，下一句一定是：你要好好挣钱攒钱。不可否认，这句话是不过时且正确的。既然是正确的，我就该做点儿事情，于是我决定换个发型，以此作为标志性事件，方便后人传颂。同时立马回家卸载了游戏，开始翻看几个月前的令人费解的老旧代码，并买了几本关于人类的书。&lt;/p&gt;
&lt;p&gt;关于这次改变，结果是令人沮丧的。但值得欣慰的是，那几本尚未拆封的书送人也不赖。&lt;/p&gt;
&lt;p&gt;经历过上次的失败，我清楚了这样的改变微不足道，未来一定会有一场大的变动，大到可以打破这牢笼。于是在变动未发生之前，我便开始了期待。其中的一个版本是这样的：我经历了某种大的祸患，比如车祸，小了上不了台面，须是那种断胳膊断腿的。说实话，每当想到这里的时候我都会兴奋异常，因为我坚信，我的人生将从此改变——无论是好是坏。&lt;/p&gt;
&lt;p&gt;但后来我认识到这样的幻想是不负责任的，因为我是个受引用的变量——有人还在依赖我——尽管我非常清楚：没有谁离不开谁，人们会伤心一小会儿，毕竟祥林嫂是小说里的人物。换句话说，我得想个其他改变的方式。可是我现在编不下去了，所以有时间再更新。&lt;/p&gt;
">牢笼</a>
      </div>
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/P5yl4XkPx/"" data-c="
          &lt;h2 id=&#34;前提&#34;&gt;前提：&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;已在&lt;a href=&#34;https://pypi.org/account/register/&#34;&gt;PyPI&lt;/a&gt;上注册账号&lt;/li&gt;
&lt;li&gt;github上已准备好待发布包&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;方案一手动执行&#34;&gt;方案一：手动执行&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;已安装twine、wheel等包  &lt;code&gt;pip install twine wheel&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;发布流程&#34;&gt;发布流程&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;编写setup.py&lt;/strong&gt;，可参考&lt;a href=&#34;https://github.com/navdeep-G/setup.py&#34;&gt;此项目&lt;/a&gt;或&lt;a href=&#34;https://github.com/broholens/pyfunctions&#34;&gt;此项目&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;打包并上传至PyPI&lt;/strong&gt;，执行&lt;code&gt;setup.py upload&lt;/code&gt;，需要输入PyPI账号及密码。&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&#34;方案二github-actions&#34;&gt;方案二：GitHub Actions&lt;/h1&gt;
&lt;p&gt;GitHub Actions提供持续集成能力，可以用来在每次push/release时，自动打包并上传到PyPI。&lt;br&gt;
入门请查看&lt;a href=&#34;http://www.ruanyifeng.com/blog/2019/09/getting-started-with-github-actions.html&#34;&gt;阮一峰的博客&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;操作步骤&#34;&gt;操作步骤&lt;/h3&gt;
&lt;h5 id=&#34;step-1-进入项目点击actions&#34;&gt;Step 1: 进入项目，点击“Actions”&lt;/h5&gt;
&lt;figure data-type=&#34;image&#34; tabindex=&#34;1&#34;&gt;&lt;img src=&#34;https://broholens.github.io/post-images/1592395665956.png&#34; alt=&#34;&#34; loading=&#34;lazy&#34;&gt;&lt;/figure&gt;
&lt;h5 id=&#34;step-2创建workflow&#34;&gt;Step 2：创建workflow&lt;/h5&gt;
&lt;p&gt;&lt;img src=&#34;https://broholens.github.io/post-images/1592395792642.png&#34; alt=&#34;&#34; loading=&#34;lazy&#34;&gt;&lt;br&gt;
&lt;img src=&#34;https://broholens.github.io/post-images/1592395990636.png&#34; alt=&#34;&#34; loading=&#34;lazy&#34;&gt;&lt;/p&gt;
&lt;h5 id=&#34;step-3配置pypi_username及pypi_password&#34;&gt;Step 3：配置PYPI_USERNAME及PYPI_PASSWORD&lt;/h5&gt;
&lt;figure data-type=&#34;image&#34; tabindex=&#34;2&#34;&gt;&lt;img src=&#34;https://broholens.github.io/post-images/1592396117747.png&#34; alt=&#34;&#34; loading=&#34;lazy&#34;&gt;&lt;/figure&gt;
&lt;p&gt;这样每次在release的时候，就会自动打包并上传到PyPI了。&lt;/p&gt;
&lt;p&gt;🚦 上传成功后如果pip使用非PyPI源需要等一段同步时间，方可使用&lt;code&gt;pip install&lt;/code&gt;下载；或更改pip源为PyPI下载。eg：&lt;code&gt;pip install pyfunctions==2020.6.17.11.52.7 -i https://pypi.python.org/simple&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;thanks-to&#34;&gt;Thanks To&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&#34;https://yq.aliyun.com/articles/644640&#34;&gt;bdist_wheel报错&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://help.github.com/en/actions/language-and-framework-guides/github-actions-for-python&#34;&gt;github-actions-for-python&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
">发布包到PyPI</a>
      </div>
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/8iPAZ5DIt/"" data-c="
          &lt;p&gt;faker提供伪造数据，包括但不限于手机号、地址、user-agent、isbn、身份证号(ssn)、信用卡信息、文章段落&lt;br&gt;
具体可以参考&lt;a href=&#34;https://faker.readthedocs.io/en/stable/providers.html#&#34;&gt;官方文档&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;faker实现逻辑&#34;&gt;faker实现逻辑&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;faker含有很多providers，每个provider用于提供一类fake数据。&lt;br&gt;&lt;/li&gt;
&lt;li&gt;faker支持多种语言，所以每类fake数据均有多种不同语言的provider类。&lt;br&gt;&lt;/li&gt;
&lt;li&gt;调用时首先通过proxy.py解析locale，支持在初始化时指定多个locale，然后将其他参数映射到factory.py生成faker对象，映射过程中会通过指定/默认locale加载指定/全部的providers。&lt;br&gt;&lt;/li&gt;
&lt;li&gt;每类fake数据都会提供一个Provider类(继承自BaseProvider)，这个Provider类提供本类数据的操作方法(如address类的city方法)，每种语言都会继承此Provider类，数据均来自于每种语言的__init__.py中。&lt;br&gt;
&lt;br&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;示例&#34;&gt;示例&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;基本示例&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;&amp;gt;&amp;gt;&amp;gt; from faker import Faker
&amp;gt;&amp;gt;&amp;gt; fake = Faker(locale=&amp;quot;zh_CN&amp;quot;)
&amp;gt;&amp;gt;&amp;gt; fake.name_female()
&#39;石红&#39;
&amp;gt;&amp;gt;&amp;gt; fake.name_male()
&#39;郭飞&#39;
&amp;gt;&amp;gt;&amp;gt; fake.phone_number()
&#39;13273633376&#39;
&amp;gt;&amp;gt;&amp;gt; fake.safe_email()
&#39;kzhu@example.net&#39;
&amp;gt;&amp;gt;&amp;gt; fake.sentence()
&#39;是否孩子事情公司解决.&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;创建自己的provider&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from faker import Faker
fake = Faker()

# first, import a similar Provider or use the default one
from faker.providers import BaseProvider

# create new provider class
class MyProvider(BaseProvider):
    def foo(self):
        return &#39;bar&#39;

# then add new provider to faker instance
fake.add_provider(MyProvider)

# now you can use:
fake.foo()
# &#39;bar&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;使用指定单词创建sentence&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from faker import Faker
fake = Faker()

my_word_list = [
&#39;danish&#39;,&#39;cheesecake&#39;,&#39;sugar&#39;,
&#39;Lollipop&#39;,&#39;wafer&#39;,&#39;Gummies&#39;,
&#39;sesame&#39;,&#39;Jelly&#39;,&#39;beans&#39;,
&#39;pie&#39;,&#39;bar&#39;,&#39;Ice&#39;,&#39;oat&#39; ]

fake.sentence()
# &#39;Expedita at beatae voluptatibus nulla omnis.&#39;

fake.sentence(ext_word_list=my_word_list)
# &#39;Oat beans oat Lollipop bar cheesecake.&#39;
&lt;/code&gt;&lt;/pre&gt;
">python faker</a>
      </div>
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/RhlpoFTTh/"" data-c="
          &lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;&amp;gt;&amp;gt;&amp;gt; from pathlib import Path
&amp;gt;&amp;gt;&amp;gt; p = Path(&#39;.&#39;)

# 列举目录
&amp;gt;&amp;gt;&amp;gt; [x for x in p.iterdir() if x.is_dir()]
[WindowsPath(&#39;.idea&#39;), WindowsPath(&#39;__pycache__&#39;)]

# 列举文件
&amp;gt;&amp;gt;&amp;gt; list(p.glob(&#39;**/*.py&#39;))
[WindowsPath(&#39;debugger.py&#39;), WindowsPath(&#39;ssh_connection.py&#39;), WindowsPath(&#39;util.py&#39;), WindowsPath(&#39;__init__.py&#39;)]

# 文件归属路径
&amp;gt;&amp;gt;&amp;gt; p.cwd()
WindowsPath(&#39;D:/ODAEDebugger/backend&#39;)

# 文件绝对路径
&amp;gt;&amp;gt;&amp;gt; p.resolve()
WindowsPath(&#39;D:/ODAEDebugger/backend/util.py&#39;)

# 文件/路径是否存在
&amp;gt;&amp;gt;&amp;gt; p.exists()
True

# 是否是路径
&amp;gt;&amp;gt;&amp;gt; p.is_file()
True

# 文件/路径stat
&amp;gt;&amp;gt;&amp;gt; p.stat()
os.stat_result(st_mode=33206, st_ino=13510798882280617, st_dev=1245727358, st_nlink=1, st_uid=0, st_gid=0, st_size=112, st_atime=1590832618, st_mtime=1590738985, st_ctime=1590738985)

# 文件后缀与文件名
&amp;gt;&amp;gt;&amp;gt; p.name
&#39;util.py&#39;
&amp;gt;&amp;gt;&amp;gt; p.suffix
&#39;.py&#39;
&amp;gt;&amp;gt;&amp;gt; p.stem
&#39;util&#39;

# 读写文件  函数内部已使用with open封装
&amp;gt;&amp;gt;&amp;gt; p.read_text()
&amp;quot;import json\n\n\ndef load_json_file(file_path):\n    with open(file_path, &#39;r&#39;)as f:\n        return json.load(f)&amp;quot;
&amp;gt;&amp;gt;&amp;gt; p.write_text(&#39;aaa&#39;)
3
&amp;gt;&amp;gt;&amp;gt; p.read_text()
&#39;aaa&#39;
&lt;/code&gt;&lt;/pre&gt;
">python pathlib</a>
      </div>
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/6387ia0vK/"" data-c="
          &lt;h2 id=&#34;127001&#34;&gt;127.0.0.1&lt;/h2&gt;
&lt;p&gt;属于环回地址，环回地址：所有发往该类地址的数据包都应该被loop back。&lt;br&gt;&lt;br&gt;
使用这个地址发送数据，则数据包不会出现在网络传输过程中。&lt;/p&gt;
&lt;h4 id=&#34;用途&#34;&gt;用途&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;测试某台机器上的网络设备，操作系统或者TCP/IP实现是否工作正常：ping 127.0.0.1&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;0000&#34;&gt;0.0.0.0&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;在服务器中，0.0.0.0指的是本机上的所有IPV4地址&lt;/li&gt;
&lt;li&gt;在路由中，0.0.0.0表示的是默认路由，即当路由表中没有找到完全匹配的路由的时候所对应的路由。&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;用途-2&#34;&gt;用途&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;如果主机有大小网两个IP，且主机上一个服务监听的地址为0.0.0.0，则两个IP均可访问该服务。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;localhost&#34;&gt;localhost&lt;/h2&gt;
&lt;p&gt;域名。默认指向127.0.0.1&lt;/p&gt;
">127.0.0.1、localhost、0.0.0.0</a>
      </div>
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/git-commit-amend-xiu-gai-commit-xin-xi-hou-push-bao-cuo/"" data-c="
          &lt;h3 id=&#34;情景复现&#34;&gt;情景复现&lt;/h3&gt;
&lt;p&gt;commit并push到远端的情况下修改commit信息&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;git commit -m &amp;quot;commit message here&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git push&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git commit --amend&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git push&lt;/code&gt;&lt;br&gt;
报错如下：&lt;br&gt;
&lt;code&gt;hint: Updates were rejected because the tip of your current branch is behind&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;解决方式&#34;&gt;解决方式：&lt;/h3&gt;
&lt;p&gt;上述第4步使用&lt;code&gt;git push -f&lt;/code&gt;&lt;/p&gt;
">git commit --amend修改commit信息后，push报错</a>
      </div>
      
      <div class="item">
        <a class="result-title" style="opacity: 0;" href="https://broholens.github.io/post/hello-gridea/"" data-c="
          &lt;p&gt;👏  欢迎使用 &lt;strong&gt;Gridea&lt;/strong&gt; ！&lt;br&gt;
✍️  &lt;strong&gt;Gridea&lt;/strong&gt; 一个静态博客写作客户端。你可以用它来记录你的生活、心情、知识、笔记、创意... ...&lt;/p&gt;
&lt;!-- more --&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/getgridea/gridea&#34;&gt;Github&lt;/a&gt;&lt;br&gt;
&lt;a href=&#34;https://gridea.dev/&#34;&gt;Gridea 主页&lt;/a&gt;&lt;br&gt;
&lt;a href=&#34;http://fehey.com/&#34;&gt;示例网站&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;特性&#34;&gt;特性👇&lt;/h2&gt;
&lt;p&gt;📝  你可以使用最酷的 &lt;strong&gt;Markdown&lt;/strong&gt; 语法，进行快速创作&lt;/p&gt;
&lt;p&gt;🌉  你可以给文章配上精美的封面图和在文章任意位置插入图片&lt;/p&gt;
&lt;p&gt;🏷️  你可以对文章进行标签分组&lt;/p&gt;
&lt;p&gt;📋  你可以自定义菜单，甚至可以创建外部链接菜单&lt;/p&gt;
&lt;p&gt;💻  你可以在 &lt;strong&gt;Windows&lt;/strong&gt;，&lt;strong&gt;MacOS&lt;/strong&gt; 或 &lt;strong&gt;Linux&lt;/strong&gt; 设备上使用此客户端&lt;/p&gt;
&lt;p&gt;🌎  你可以使用 &lt;strong&gt;𝖦𝗂𝗍𝗁𝗎𝖻 𝖯𝖺𝗀𝖾𝗌&lt;/strong&gt; 或 &lt;strong&gt;Coding Pages&lt;/strong&gt; 向世界展示，未来将支持更多平台&lt;/p&gt;
&lt;p&gt;💬  你可以进行简单的配置，接入 &lt;a href=&#34;https://github.com/gitalk/gitalk&#34;&gt;Gitalk&lt;/a&gt; 或 &lt;a href=&#34;https://github.com/SukkaW/DisqusJS&#34;&gt;DisqusJS&lt;/a&gt; 评论系统&lt;/p&gt;
&lt;p&gt;🇬🇧  你可以使用&lt;strong&gt;中文简体&lt;/strong&gt;或&lt;strong&gt;英语&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;🌁  你可以任意使用应用内默认主题或任意第三方主题，强大的主题自定义能力&lt;/p&gt;
&lt;p&gt;🖥  你可以自定义源文件夹，利用 OneDrive、百度网盘、iCloud、Dropbox 等进行多设备同步&lt;/p&gt;
&lt;p&gt;🌱 当然 &lt;strong&gt;Gridea&lt;/strong&gt; 还很年轻，有很多不足，但请相信，它会不停向前 🏃&lt;/p&gt;
&lt;p&gt;未来，它一定会成为你离不开的伙伴&lt;/p&gt;
&lt;p&gt;尽情发挥你的才华吧！&lt;/p&gt;
&lt;p&gt;😘 Enjoy~&lt;/p&gt;
">Hello Gridea</a>
      </div>
      
    </div>
    <div class="page">
      <div id="page_ul"></div>
    </div>
  </div>
</div>
<script>
  !function () {
    let searchMask = document.querySelector('#search_mask');
    let result = document.querySelector('#result');
    let items = document.querySelectorAll('.item');
    let searchBox = document.querySelector('#search');
    let statCount = document.querySelector('#stat_count');
    let statTimes = document.querySelector('#stat_times');
    let pageUl = document.querySelector('#page_ul');
    let close = document.querySelector('#close');
    
    close.addEventListener('click', function() {
      searchMask.style = 'display: none;'
    })

    let finds = [];
    let contents = [];
    let pageSize = 10;
    items.forEach(item => {
      let a = item.querySelector('a');
      contents.push({
        title: a.innerText,
        details: a.dataset.c,
        link: a.href
      })
      item.remove();
    })

    function insertStr(soure, start, count) {
      let newStr = soure.substr(start, count);
      return soure.slice(0, start) + '<em>' + newStr + '</em>' + soure.slice(start + count);
    }

    pageUl.addEventListener('click', function(event) {
      let target = event.target;
      if (target.__proto__ === HTMLSpanElement.prototype) {
        appendResults(parseInt(target.dataset.i));
      }
    })

    function appendResults(index) {
      let htmlResult = '';
      let start = index || 0;
      let end = Math.min(start + pageSize, finds.length);
      for (let i = start; i < end; i++) {
        const current = finds[i];
        let html = current.title;
        let sum = 0;
        let positions = current.positions;
        positions.forEach(position => {
          html = insertStr(html, position.start + sum, position.count);
          sum += 9;
        })
        htmlResult += `<div class="item"><a class="result-title" href="${current.link}">${html}</a></div>`;
      }
      result.innerHTML = htmlResult;
      pageUl.innerHTML = '';
      let count = finds.length / pageSize;
      let lis = '';
      if (start !== 0) {
        lis += `<span class="fa fa-angle-left" data-i='${start - 1}'></span>`;
      }
      for (let i = 0; i < count; i++) {
        lis += `<span class='${i === start?'current':''}' data-i='${i}'>${i+1}</span>`;     
      }
      if (start+1 < count) {
        lis += `<span class="fa fa-angle-right" data-i='${start+1}'></span>`;  
      }
      pageUl.innerHTML = lis;
    }

    function search(delay) {
      let timer = null
      return function () {
        clearTimeout(timer)
        timer = setTimeout(() => {
          let start = Date.now();
          let segments = searchBox.value.split(' ').filter(c => c != '');
          if (segments.length <= 0) {
            return;
          }
          finds = [];
          let htmlResult = '';
          contents.forEach(content => {
            let title = content.title;
            let positions = [];
            let find = false;
            segments.forEach((segment) => {
              if (content.title.includes(segment)) {
                find = true;
                positions.push({
                  start: content.title.indexOf(segment),
                  count: segment.length
                })
              } else if (content.details.includes(segment)) {
                find = true;
              }
            });
            if (find) {
              finds.push({
                title: content.title,
                link: content.link,
                positions
              });
            }
          })
          appendResults(0);
          statCount.textContent = finds.length;
          statTimes.textContent = Date.now() - start;
        }, delay)
      }
    }
    searchBox.addEventListener('input', search(200));
  }()
</script>

<input hidden id="copy" />
<script>
  let language = '';
  if (language !== '') {
    let map = new Map();
    if (language === 'en') {
      map.set('search', 'Search');
      map.set('category', 'Categories');
      map.set('article', 'Articles');
      map.set('tag', 'Tags');
      map.set('top', 'Top');
      map.set('publish', 'published');
      map.set('minute', ' minutes');
      map.set('read-more', 'Read More');
      map.set('view', 'View');
      map.set('words', ' words');
      map.set('category-in', 'category in');
      map.set('preview', 'Meta');
      map.set('index', 'Toc');
      map.set('no-archives', "You haven't created yet");
      map.set('archives', " articles in total");
      map.set('cloud-tags', " tags in total");
      map.set('copyright', "Copyright: ");
      map.set('author', "Author: ");
      map.set('link', "Link: ");
      map.set('leave-message', "Leave a message");
      map.set('format', "Links Format");
      map.set('site-name', "Name: ");
      map.set('site-link', "Link: ");
      map.set('site-desc', "Desc: ");
      map.set('stat', " related results, taking ");
      map.set('stat-time', " ms");
      map.set('site-img', "Image: ");
    }

    if (map.size > 0) {
      let lanElems = document.querySelectorAll('.language');
      lanElems.forEach(elem => {
        let lan = elem.dataset.lan, text = map.get(lan);
        if (elem.__proto__ === HTMLInputElement.prototype) {
          elem.placeholder = text
        } else {
          if (elem.dataset.count) {
            text = elem.dataset.count + text;
          }
          elem.textContent = text;
        }
      })
    }
  }
  //拿来主义(真香)^_^，Clipboard 实现摘自掘金 https://juejin.im/post/5aefeb6e6fb9a07aa43c20af
  window.Clipboard = (function (window, document, navigator) {
    var textArea,
      copy;

    // 判断是不是ios端
    function isOS() {
      return navigator.userAgent.match(/ipad|iphone/i);
    }
    //创建文本元素
    function createTextArea(text) {
      textArea = document.createElement('textArea');
      textArea.value = text;
      textArea.style.width = 0;
      textArea.style.height = 0;
      textArea.clientHeight = 0;
      textArea.clientWidth = 0;
      document.body.appendChild(textArea);
    }
    //选择内容
    function selectText() {
      var range,
        selection;

      if (isOS()) {
        range = document.createRange();
        range.selectNodeContents(textArea);
        selection = window.getSelection();
        selection.removeAllRanges();
        selection.addRange(range);
        textArea.setSelectionRange(0, 999999);
      } else {
        textArea.select();
      }
    }

    //复制到剪贴板
    function copyToClipboard() {
      try {
        document.execCommand("Copy")
      } catch (err) {
        alert("复制错误！请手动复制！")
      }
      document.body.removeChild(textArea);
    }

    copy = function (text) {
      createTextArea(text);
      selectText();
      copyToClipboard();
    };

    return {
      copy: copy
    };
  })(window, document, navigator);

  function copyCode(e) {
    if (e.srcElement.tagName === 'SPAN' && e.srcElement.classList.contains('copy-code')) {
      let code = e.currentTarget.querySelector('code');
      var text = code.innerText;
      if (e.srcElement.textContent === '复制成功') {
        console.log('复制操作频率过高');
        return;
      }
      e.srcElement.textContent = '复制成功';
      (function (elem) {
        setTimeout(() => {
          if (elem.textContent === '复制成功') {
            elem.textContent = '复制代码'
          }
        }, 1000);
      })(e.srcElement)
      Clipboard.copy(text);
    }
  }

  let pres = document.querySelectorAll('pre');
  pres.forEach(pre => {
    let code = pre.querySelector('code');
    let copyElem = document.createElement('span');
    copyElem.classList.add('copy-code');
    copyElem.textContent = '复制代码';
    pre.appendChild(copyElem);
    pre.onclick = copyCode
  })

</script>
<script src="/media/js/motion.js"></script>

<script src="https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll/dist/smooth-scroll.polyfills.min.js"></script>
<script>
  var scroll = new SmoothScroll('a[href*="#"]', {
    speed: 200
  });
</script>


<script src="/media/js/mouse/love.js"></script>


</html>